package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.dao.CmSysMenuMapper;
import com.cm.caseManagement.pojo.entity.CmSysMenu;
import com.cm.caseManagement.service.ICmSysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cm.caseManagement.utils.DateUtils;

import java.util.List;

/**
 * 菜单权限Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmSysMenuServiceImpl implements ICmSysMenuService
{
    @Autowired
    private CmSysMenuMapper cmSysMenuMapper;

    /**
     * 查询菜单权限
     *
     * @param id 菜单权限主键
     * @return 菜单权限
     */
    @Override
    public CmSysMenu selectCmSysMenuById(Long id)
    {
        return cmSysMenuMapper.selectCmSysMenuById(id);
    }

    /**
     * 查询菜单权限列表
     *
     * @param cmSysMenu 菜单权限
     * @return 菜单权限
     */
    @Override
    public List<CmSysMenu> selectCmSysMenuList(CmSysMenu cmSysMenu)
    {
        return cmSysMenuMapper.selectCmSysMenuList(cmSysMenu);
    }

    /**
     * 新增菜单权限
     *
     * @param cmSysMenu 菜单权限
     * @return 结果
     */
    @Override
    public int insertCmSysMenu(CmSysMenu cmSysMenu)
    {
        cmSysMenu.setCreateTime(DateUtils.getNowDate());
        return cmSysMenuMapper.insertCmSysMenu(cmSysMenu);
    }

    /**
     * 修改菜单权限
     *
     * @param cmSysMenu 菜单权限
     * @return 结果
     */
    @Override
    public int updateCmSysMenu(CmSysMenu cmSysMenu)
    {
        cmSysMenu.setUpdateTime(DateUtils.getNowDate());
        return cmSysMenuMapper.updateCmSysMenu(cmSysMenu);
    }

    /**
     * 批量删除菜单权限
     *
     * @param ids 需要删除的菜单权限主键
     * @return 结果
     */
    @Override
    public int deleteCmSysMenuByIds(Long[] ids)
    {
        return cmSysMenuMapper.deleteCmSysMenuByIds(ids);
    }

    /**
     * 删除菜单权限信息
     *
     * @param id 菜单权限主键
     * @return 结果
     */
    @Override
    public int deleteCmSysMenuById(Long id)
    {
        return cmSysMenuMapper.deleteCmSysMenuById(id);
    }
}
